//
//  SXTThirdLogInView.m
//  SYT
//
//  Created by 彭之耀 on 2017/9/4.
//  Copyright © 2017年 个人学习. All rights reserved.
//

#import "SXTThirdLogInView.h"

@interface SXTThirdLogInView ()

@property (strong,nonatomic) UIButton *QQLoginButton;      //QQ登录
@property (strong,nonatomic) UIButton *WXLoginButton;      //微信登录
@property (strong,nonatomic) UIButton *sinaLoginButton;    //新浪登录
@property (strong,nonatomic) UILabel *OneKeyLoginLabel;    //一键登录
@property (strong,nonatomic) UILabel *lineLabel;           //分割线

@end

@implementation SXTThirdLogInView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self addSubview:self.QQLoginButton];
        [self addSubview:self.WXLoginButton];
        [self addSubview:self.sinaLoginButton];
        [self addSubview:self.lineLabel];
        [self addSubview:self.OneKeyLoginLabel];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    __weak typeof (self)weakSelf = self;
    
    [_OneKeyLoginLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(80, 20));
        make.centerX.equalTo(weakSelf.mas_centerX);
        make.top.equalTo(weakSelf.mas_top);
    }];
    [_WXLoginButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.OneKeyLoginLabel.mas_bottom).offset(20);
        make.size.mas_equalTo(CGSizeMake(45, 45));
        make.centerX.equalTo(weakSelf.mas_centerX);
    }];
    [_QQLoginButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.OneKeyLoginLabel.mas_bottom).offset(20);
        make.size.mas_equalTo(CGSizeMake(45, 45));
        make.right.equalTo(weakSelf.WXLoginButton.mas_left).offset(-(VIEW_WIDTH-135)/4);
    }];
    [_sinaLoginButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.OneKeyLoginLabel.mas_bottom).offset(20);
        make.size.mas_equalTo(CGSizeMake(45, 45));
        make.left.equalTo(weakSelf.WXLoginButton.mas_right).offset((VIEW_WIDTH-135)/4);
    }];
    [_lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.OneKeyLoginLabel.mas_centerY);
        make.height.equalTo(@1);
        make.left.equalTo(weakSelf.mas_left).offset(16);
        make.right.equalTo(weakSelf.mas_right).offset(-16);
    }];
}

-(UILabel *)lineLabel{
    if (!_lineLabel) {
        _lineLabel = [[UILabel alloc]init];
        _lineLabel.backgroundColor = rgb(190, 190, 190);
    }
    return _lineLabel;
}



-(UIButton *)QQLoginButton{
    if (!_QQLoginButton) {
        _QQLoginButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_QQLoginButton setImage:[UIImage imageNamed:@"登录界面qq登陆"] forState:UIControlStateNormal];
    }
    return _QQLoginButton;
}

-(UIButton *)WXLoginButton{
    if (!_WXLoginButton) {
        _WXLoginButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_WXLoginButton setImage:[UIImage imageNamed:@"登录界面微信登录"] forState:UIControlStateNormal];
    }
    return _WXLoginButton;
}

-(UIButton *)sinaLoginButton{
    if (!_sinaLoginButton) {
        _sinaLoginButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_sinaLoginButton setImage:[UIImage imageNamed:@"登陆界面微博登录"] forState:UIControlStateNormal];
    }
    return _sinaLoginButton;
}

-(UILabel *)OneKeyLoginLabel{
    if (!_OneKeyLoginLabel) {
        _OneKeyLoginLabel = [[UILabel alloc]init];
        _OneKeyLoginLabel.text = @"一键登录";
        _OneKeyLoginLabel.textColor = rgb(190, 190, 190);
        _OneKeyLoginLabel.backgroundColor = MainColor;
        _OneKeyLoginLabel.textAlignment = NSTextAlignmentCenter;
        _OneKeyLoginLabel.font = [UIFont systemFontOfSize:16.0];
    }
    return _OneKeyLoginLabel;
}



@end
